drop table spmi_ods.spmi_transfer_avg_weight_report;
CREATE EXTERNAL TABLE IF NOT EXISTS spmi_ods.spmi_transfer_avg_weight_report(
id                                                 bigint                         COMMENT '主键ID',
task_id                                            bigint                         COMMENT '任务ID',
task_name                                          String                         COMMENT '任务名',
bill_generation_date                               String                         COMMENT '统计日期',
avg_type                                           bigint                         COMMENT '均重模式：1日均 2月均',
start_network_id                                   bigint                         COMMENT '均重网点ID',
start_network_code                                 String                         COMMENT '均重网点CODE',
start_network_name                                 String                         COMMENT '均重网点NAME',
end_network_id                                     bigint                         COMMENT '流向区域ID',
end_network_code                                   String                         COMMENT '流向区域CODE',
end_network_name                                   String                         COMMENT '流向区域NAME',
weight_section                                     String                         COMMENT '重量段',
sum_weight                                         Double                         COMMENT '总重量',
sum_num                                            bigint                         COMMENT '总票数',
avg_weight                                         Double                         COMMENT '均重重量',
create_by                                          bigint                         COMMENT '创建人ID',
create_by_name                                     String                         COMMENT '创建人NAME',
create_by_network_id                               bigint                         COMMENT '创建网点ID',
create_by_network_code                             String                         COMMENT '创建网点CODE',
create_by_network_name                             String                         COMMENT '创建网点NAME',
create_time                                        timestamp                      COMMENT '创建时间'
)
COMMENT '均重日月汇总结果表'
PARTITIONED BY (dt STRING COMMENT '全量快照表 (yyyy-MM-dd)')
STORED AS PARQUET
LOCATION '/dw/hive/spmi_ods.db/external/spmi_transfer_avg_weight_report'
TBLPROPERTIES (
  'parquet.column.index.access'='true'
);